package com.example.demo.proxy;

public class HouseProxy implements HouseSubject{

    private RealHouseSubject subject;

    public HouseProxy(RealHouseSubject subject){
        this.subject = subject;//中介代理的房子实际上是房东的房子
    }

    @Override
    public void rent() {
        System.out.println("我是中介,我帮房东开始代理");
        subject.rent();
        System.out.println("我是中介,我帮房东结束代理");
    }

    @Override
    public void sale() {
        System.out.println("我是中介,我帮房东开始代理");
        subject.sale();
        System.out.println("我是中介,我帮房东结束代理");
    }
}
